#include "cgroup.h"

QList<CGroup*>  CGroup::groupList;
int             CGroup::groupRun;
double          CGroup::groupSq;
int             CGroup::groupRunGr;

CGroup::CGroup(CProduct* product)
{
    this->grProductList.push_back(product);
}

bool CGroup::addProduct (CProduct* product)
{
    if (product->prWidth == grProductList[0]->prWidth
        && product->prHeight == grProductList[0]->prHeight)
    {
        grProductList << product;
        return true;
    }
    else
        return false;
}

double CGroup::getSq()
{
    double sq = 0;
    foreach (CProduct* product, this->grProductList)
        sq += product->getPrSq();
    return sq;
}
